using Gateway.Common.Extensions;
using Gateway.Domain.EFCore.Configuration;
using Gateway.Domain.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Gateway.Domain.Configuration;

public class SystemSettingConfiguration : AggregateRootEntityConfiguration<SystemSetting>
{
    public override void Configure(EntityTypeBuilder<SystemSetting> builder)
    {
        builder.ToTable(t => t.HasComment("系统配置表"));
        base.Configure(builder);
        builder.Property(x => x.LogoUrl).IsRequired().HasMaxLength(500).HasComment("系统名称");
        builder.Property(x => x.SystemName).HasMaxLength(500).HasComment("LogoUrl");

        builder.Property(x => x.LoginType).IsRequired().HasMaxLength(10)
            .HasComment("登录开关  all 普通用户+管理员用户  user 普通用户 admin 管理员用户");
        builder.Property(x => x.PasswordRegex).HasMaxLength(500).HasComment("密码验证规则");

        builder.Property(x => x.Copyright).HasMaxLength(2000).HasComment("版权信息");
    }
}